Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💥 Make service FKs in API group config models not nullable #4916

Merged
merged 2 commits into from
Dec 17, 2024

Conversation

sergei-maertens
Copy link
Member

Part of #3283

Changes

  • Added check script for data that would violate the new constraints
  • Added check script to upgrade path checks
  • Made the FK fields on Objects/ZGW API group models null=False for the non-optional fields.

Checklist

Check off the items that are completed or not relevant.

  • Impact on features

    • Checked copying a form
    • Checked import/export of a form
    • Config checks in the configuration overview admin page
    • Problem detection in the admin email digest is handled
  • Release management

    • I have labelled the PR as "needs-backport" accordingly
  • I have updated the translations assets (you do NOT need to provide translations)

    • Ran ./bin/makemessages_js.sh
    • Ran ./bin/compilemessages_js.sh
  • Dockerfile/scripts

    • Updated the Dockerfile with the necessary scripts from the ./bin folder
  • Commit hygiene

    • Commit messages refer to the relevant Github issue
    • Commit messages explain the "why" of change, not the how

Catalogi and Documents API are optional, but the objecttypes and objects
API services are not. These fields were null because the model was
originally a django-solo singleton model which must be able to be
created without any services existing prior.

A check script is added to prevent being stuck in half-migrated
upgrades.
Left-overs from a django-solo model too (see previous commit), these
fields really cannot be empty to do anything useful.

This properly sets up the required constraints at the database level
and removes confusion in the application code.
Copy link

codecov bot commented Dec 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.57%. Comparing base (3a70208) to head (3f27cb1).
Report is 14 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4916      +/-   ##
==========================================
- Coverage   96.57%   96.57%   -0.01%     
==========================================
  Files         757      757              
  Lines       25750    25748       -2     
  Branches     3383     3377       -6     
==========================================
- Hits        24869    24867       -2     
  Misses        616      616              
  Partials      265      265              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sergei-maertens sergei-maertens changed the title Make service FKs in API group config models not nullable 💥 Make service FKs in API group config models not nullable Dec 13, 2024
headers=("API group type", "ID", "Name", "Problem"),
)
)
return True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a major thing, but does this have to return something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, the return value is checked by the upgrade check which blocks migrating if problems are detected! See

for script in self.scripts:

@sergei-maertens sergei-maertens merged commit 25c04e3 into master Dec 17, 2024
33 checks passed
@sergei-maertens sergei-maertens deleted the cleanup/3283-make-fields-not-nullable branch December 17, 2024 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants